import java.util.*;


public class Calendar {

public static void main (String[] args){
    String[] inputDate = getInput();

    int date = Integer.valueOf(inputDate[0]);
    String month = String.valueOf(inputDate[1]).toLowerCase();
    int monthNumber = getMonth(month);
    int year = Integer.valueOf(inputDate[2]);

    Calendar enteredDate = GregorianCalendar.getInstance();
    enteredDate.set(year, monthNumber, date);

    System.out.print("Day of the week: ");
    System.out.printf("%tA", enteredDate);
}
    
    private static String[] getInput(){
        Scanner input = new Scanner(System.in);
	      System.out.print("Enter Date: ");
	      String inputString[] = input.nextLine().split(" ");
	      return inputString;
    }
  
    private static int getMonth(String value){
	      String[] monthes = {"january", "february", "march", "april", "may", 
			                      "june", "july", "august", "september", "october",
			                      "november", "december"};

	      List<String> monthList = new ArrayList<String>(monthes.length);
        monthList = Arrays.asList(monthes);
        int monthIndex = monthList.indexOf(value);	
	      return monthIndex;	
    }   
}